﻿using DotsGame;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unity.Burst;
using Unity.Jobs.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;

class comp_init : MonoBehaviour
{
    private void Start()
    {
        var data = CommonData.Instance;
        data.Data.Init();
        var v = new CommandToSystem()
        {
            type = CommandToSystemType.CreateUnit,
            pos = float3.zero,
            dir = new float3(0, 0, 1),
            scale = 10,
            camp = 0,
            maintarget = true,
            typeid = 0,
            count = 1,
            mode = PosMode.Point,
        };
        data.Data.queueCmdToSystem.Enqueue(v);
        //var data4 = CommonData.Instance;
        Debug.Log("JobsUtility.ThreadIndexCount=" + JobsUtility.ThreadIndexCount);
    }
    float timerMonster = 1.0f;
    private void Update()
    {
        var data = CommonData.Instance;
        timerMonster -= Time.deltaTime;
        if (timerMonster < 0)
        {
            var v = new CommandToSystem()
            {
                type = CommandToSystemType.CreateUnit,
                pos = float3.zero,
                dir = new float3(0, 0, 1),
                scale = 1.0f,
                camp = 1, //敌人
                maintarget = false,//小兵
                typeid = 1, //modelid
                count = 1000,
                mode = PosMode.BigCircle
            };
            data.Data.queueCmdToSystem.Enqueue(v);
            timerMonster = 1.0f;
        }
    }
    private void OnGUI()
    {
        var data = CommonData.Instance;
        GUIUtility.ScaleAroundPivot(new Vector2(3, 3), Vector2.zero);
        GUILayout.Label("阵营A 单位=" + data.Data.campA.UnitCount);
        GUILayout.Label("阵营A 重要单位=" + data.Data.campA.MainUnitCount);
        GUILayout.Label("阵营B 单位=" + data.Data.campB.UnitCount);
        GUILayout.Label("阵营B 重要单位=" + data.Data.campB.MainUnitCount);
        GUILayout.Label("Effect=" + data.Data.EffectCount);
    }
}

